<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>Countdown to NCEE</title>
    <link rel="stylesheet" href="style.css">
</head>

<body>
    <div class="container">
        <h2><span>Countdown to NCEE</span> 2022</h2>
        <div class="countdown">
            <div id="day">NA</div>
            <div id="hour">NA</div>
            <div id="minute">NA</div>
            <div id="second">NA</div>
        </div>
    </div>

</body>

</html>
<script type="text/javascript">

    function getEndTime(myYear) {
        var myEndTime = new Date('' + myYear + '/06/07 00:00:00');
        return myEndTime;
    }

    function countDown() {
        var mydate = new Date();
        var year = '2022';
        var EndTime = getEndTime(year);
        var NowTime = new Date();
        if ((EndTime.getTime() - NowTime.getTime()) < 0) {
            year = mydate.getFullYear() + 1;
            EndTime = getEndTime(year);
        }
        var t = EndTime.getTime() - NowTime.getTime();



        var d = Math.floor(t / 1000 / 60 / 60 / 24);
        var h = Math.floor(t / 1000 / 60 / 60 % 24);
        var m = Math.floor(t / 1000 / 60 % 60);
        var s = Math.floor(t / 1000 % 60);

        document.getElementById('day').innerText = d;
        document.getElementById('hour').innerText = h;
        document.getElementById('minute').innerText = m;
        document.getElementById('second').innerText = s;
    }
    setInterval(countDown, 1000);
</script>